home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / dynamenu / dmview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  3.2 KB  |  121 lines

  1. // dmview.cpp
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. //
  13. // Purpose: implementation of the CDynaMenuView class
  14. //
  15. // Functions:
  16. //   Most of this file was generated by AppWizard.  The functions
  17. //   which contain code specific to this sample are:
  18. //
  19. //      CDynaMenuView::OnDraw()             -- draw the view contents
  20.  
  21. #include "stdafx.h"
  22. #include "dynamenu.h"
  23. #include "mainfrm.h"
  24. #include "dmdoc.h"
  25. #include "dmview.h"
  26.  
  27. #ifdef _DEBUG
  28. #undef THIS_FILE
  29. static char BASED_CODE THIS_FILE[] = __FILE__;
  30. #endif
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CDynaMenuView
  34.  
  35. IMPLEMENT_DYNCREATE(CDynaMenuView, CView)
  36.  
  37. BEGIN_MESSAGE_MAP(CDynaMenuView, CView)
  38.     //{{AFX_MSG_MAP(CDynaMenuView)
  39.         // NOTE - the ClassWizard will add and remove mapping macros here.
  40.         //    DO NOT EDIT what you see in these blocks of generated code!
  41.     //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CDynaMenuView construction/destruction
  46.  
  47. CDynaMenuView::CDynaMenuView()
  48. {
  49. }
  50.  
  51. CDynaMenuView::~CDynaMenuView()
  52. {
  53. }
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CDynaMenuView drawing
  57.  
  58. //***********************************************************************
  59. // Function: CDynaMenuView::OnDraw()
  60. //
  61. // Purpose:
  62. //    OnDraw is called by the framework to render an image of the
  63. //    document.
  64. //
  65. //    We'll just put a string in the center of the client area for
  66. //    demonstration purposes.  The string is drawn in the current
  67. //    color selected for the associated document.
  68. //
  69. // Parameters:
  70. //    none
  71. //
  72. // Returns:
  73. //    none.
  74. //
  75. // Comments:
  76. //    see the CView::OnDraw() documentation for further information
  77. //
  78. //***********************************************************************
  79. void CDynaMenuView::OnDraw(CDC* pDC)
  80. {
  81.     CDynaMenuDoc* pDoc = GetDocument();
  82.     ASSERT_VALID(pDoc);
  83.  
  84.     // set color to use for text
  85.     int iColor   = pDoc->m_iColor;
  86.  
  87.     pDC->SetTextColor(CDynaMenuDoc::m_aColorDef[iColor].m_crf);
  88.     pDC->SetBkMode(TRANSPARENT);
  89.  
  90.     // output a string to the center of the client area
  91.     CRect rc;
  92.     GetClientRect(rc);
  93.  
  94.     pDC->DrawText(CString((LPCTSTR)IDS_DYNAMENU), -1,
  95.                   rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
  96.  
  97. }
  98.  
  99. /////////////////////////////////////////////////////////////////////////////
  100. // CDynaMenuView diagnostics
  101.  
  102. #ifdef _DEBUG
  103. void CDynaMenuView::AssertValid() const
  104. {
  105.     CView::AssertValid();
  106. }
  107.  
  108. void CDynaMenuView::Dump(CDumpContext& dc) const
  109. {
  110.     CView::Dump(dc);
  111. }
  112.  
  113. CDynaMenuDoc* CDynaMenuView::GetDocument() // non-debug version is inline
  114. {
  115.     return STATIC_DOWNCAST(CDynaMenuDoc, m_pDocument);
  116. }
  117. #endif //_DEBUG
  118.  
  119. /////////////////////////////////////////////////////////////////////////////
  120. // CDynaMenuView message handlers
  121.